Share via

Fname in VBA

Anonymous
2023-10-11T11:01:45+00:00

Dear Microsoft team.

I have been trying to create a Macro that saves my Excel worksheet as a PDF-file, with cell values in the name.

The Macro works fine until I try to include the date ( named "dato" in VBA), the cell reference has been crosschecked and is correct.. But why do i keep getting an error whenever i try to include this values.?

Kind regards

Microsoft 365 and Office | Excel | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Rory Archibald 18,885 Reputation points Volunteer Moderator
    2023-10-11T11:58:23+00:00

    Most likely the date format is the problem - you can't use forward slashes in the file name. Try formatting the date - eg:

    dato=Format$(Range("Ae10").value, "yyyy-mm-dd")

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-10-11T11:02:28+00:00

    Error message here*

    Was this answer helpful?

    0 comments No comments